package com.leetcode.partition17;

import java.util.ArrayList;
import java.util.List;

/**
 * @author rkc
 * @date 2022/8/19 9:05
 */
public class LC1656设计有序流 {
    
    private static class OrderedStream {

        private int ptr = 1;
        private String[] p;

        public OrderedStream(int n) {
            p = new String[n + 10];
        }

        public List<String> insert(int idKey, String value) {
            List<String> ans = new ArrayList<>();
            p[idKey] = value;
            while (p[ptr] != null) {
                ans.add(p[ptr]);
                ptr++;
            }
            return ans;
        }
    }
}
